<template>
  <div>
    <el-form-item label="文本长度">
      <div style="display:flex; gap:4px">
        <el-input-number v-model="localData.minlength" controls-position="right" placeholder="最小长度" />
        -
        <el-input-number v-model="localData.maxlength" controls-position="right" placeholder="最大长度"
        /></div>
    </el-form-item>
    <el-form-item label="输入框行数">
      <div style="display:flex; gap:4px">
        <el-input-number v-model="localData.minRows" controls-position="right" placeholder="最小行数" />
        -
        <el-input-number v-model="localData.maxRows" controls-position="right" placeholder="最大行数"
        /></div>
    </el-form-item>
    <el-form-item label="展示字数统计" v-if="localData.maxlength">
      <el-switch v-model="localData.showWordLimit" />
    </el-form-item>
  </div>
</template>

<script>
export default {
  name: 'ConfigTextarea',
  props: {
    data: {
      type: Object,
      default: () => {}
    },
    formJson: {
      type: Object,
      default: () => {}
    }
  },
  data() {
    return {
      options: [
        {
          value: '1',
          label: '公式编辑'
        }
      ],
      localData: {}
    }
  },
  watch: {
    data: {
      handler(newVal) {
        if (newVal) {
          this.localData = newVal
        }
      },
      deep: true,
      immediate: true
    },
    localData: {
      handler(newVal) {
        this.$emit('update:data', newVal)
      },
      deep: true
    }
  }
}
</script>
